package common

type Config struct {
	APP struct {
		Port    int    `json:"port"`
		Version string `json:"version"`
	}
	Database struct {
		Host     string `json:"host"`
		Port     int    `json:"port"`
		UsrName  string `json:"username"`
		Password string `json:"password"`
		DBName   string `json:"dbname"`
	}
}

func LoadingConfig() *Config {
	// 加载配置文件
	var cfg Config = Config{
		APP: struct {
			Port    int    `json:"port"`
			Version string `json:"version"`
		}{
			Port:    8080,
			Version: "1.0.0",
		},
		Database: struct {
			Host     string `json:"host"`
			Port     int    `json:"port"`
			UsrName  string `json:"username"`
			Password string `json:"password"`
			DBName   string `json:"dbname"`
		}{
			Host:     "8.153.175.159",
			Port:     3306,
			UsrName:  "root",
			Password: "seed1ur9Eid}oo0",
			DBName:   "gin_chat",
		},
	}

	return &cfg
}
